
 
int brightness = 0;

int D6=12;

void setup(void){
    pinMode(D6, OUTPUT);
    Serial.begin(9600);
}

void loop(void){
    //Low to High，实际大于 700 后亮度变化不明显
    for(brightness = 0; brightness < 300; brightness++){//0 - 1023
        analogWrite(D6, brightness);
        Serial.println(brightness);
        delay(1);
    }

    //High to Low
    for(brightness = 300; brightness >= 0; brightness--){
        analogWrite(D6, brightness);
        Serial.println(brightness);
        delay(1);
    }
}
